#include <iostream>
#include "handle.h"

Handle::Handle(Handle *succ)
{
    succ_ = succ;
}

Handle::~Handle()
{
}

void Handle::SetSuccessor(Handle *succ)
{
    succ_ = succ;
}

Handle *Handle::GetSuccessor()
{
    return succ_;
}

void HandleA::Request()
{
    if (GetSuccessor())
    {
        GetSuccessor()->Request();
    }
    else
    {
        std::cout << "HandleA::Request." << std::endl;
    }
}

void HandleB::Request()
{
    if (GetSuccessor())
    {
        GetSuccessor()->Request();
    }
    else
    {
        std::cout << "HandleB::Request." << std::endl;
    }
}



